<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <title>回复</title>
    <!-- 1. 导入CSS的全局样式 -->
    <link href="${pageContext.request.contextPath}/css/bootstrap.min.css" rel="stylesheet">
    <!-- 2. jQuery导入，建议使用1.9以上的版本 -->
    <script src="${pageContext.request.contextPath}/js/jquery-2.1.0.min.js"></script>
    <!-- 3. 导入bootstrap的js文件 -->
    <script src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>

</head>
<body>
<div class="container">
    <div style="margin: 5px">
        <a class="btn btn-primary"
           href="${pageContext.request.contextPath}/UserBlog/Blog?id=${sessionScope.blog.id}">返回</a>
    </div>
    <p style="text-align: center;" class="bg-info">---</p>

    <h2 style="text-align: center;">Blog</h2>


    <h3 style="text-align: center;"><small>回复用户:<c:if test="${requestScope.replyUsername==null}">游客账户</c:if>
        <c:if test="${requestScope.replyUsername!=null}">${requestScope.replyUsername}</c:if> </small>${requestScope.comment.content}
    </h3>
    <%--这下面的评论有关的了--%>
    <p style="text-align: center;" class="bg-info">---</p>
    <h4 style="text-align: center;">回复区<small>快来留下你的回复吧</small></h4>
    <form action="${pageContext.request.contextPath}/BlogComment/addReplyComment?bid=${sessionScope.blog.id}&uid=${sessionScope.user.id}&cid=${requestScope.comment.id}&cuid=${requestScope.comment.userid}"
          method="post">
        <textarea class="form-control" rows="4" name="comment" placeholder="请在此输入回复"></textarea>
        <input style="margin:5px" class="btn btn btn-primary" type="submit" value="提交">
    </form>
    <p style="text-align: center;" class="bg-info">---</p>
    <!-- 显示的信息框 -->
    <c:if test="${requestScope.reply_msg!=null}">
        <div class="alert alert-warning alert-dismissible" role="alert">
            <button type="button" class="close" data-dismiss="alert">
                <span>&times;</span></button>
            <strong>${requestScope.reply_msg}</strong>
        </div>
    </c:if>


    <c:if test="${requestScope.replyList!=null}">
        <c:forEach items="${requestScope.replyList}" var="comment" varStatus="s">
            <blockquote>
                <p>${comment.content} <a style="right: auto"
                                         href="${pageContext.request.contextPath}/BlogComment/replyComment?bid=${comment.blogid}&prior=${comment.id}&cuid=${comment.userid}"
                                         class="btn btn-default btn-xs " role="button">查看回复</a>
                    <c:if test="${comment.userid==sessionScope.user.id}">
                        <a style="right: auto"
                           href="${pageContext.request.contextPath}/BlogComment/deleteComment?cid=${comment.id}&bid=${comment.blogid}"
                           class="btn btn-default btn-xs " role="button">删除</a>
                    </c:if>
                </p>
            </blockquote>
        </c:forEach>

    </c:if>
    <c:if test="${requestScope.replyList==null||requestScope.replyList.size()==0}">
        当前没有回复哦,快来抢沙发吧
    </c:if>
    <p style="text-align: center;" class="bg-info">---</p>
</div>
</body>
</html>
